﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KStarProxy
{


    /// <summary>
    /// 数据所属市场
    /// </summary>
    public enum DMarketDataType
    {
        /// <summary>
        /// 中金所
        /// </summary>
        F = 0,

        /// <summary>
        /// 大连商品期货交易所
        /// </summary>
        D = 1,

        /// <summary>
        /// 上海期货交易所
        /// </summary>
        S = 2,

        /// <summary>
        /// 郑州商品期货交易所
        /// </summary>
        Z = 3,

        /// <summary>
        /// 未知市场
        /// </summary>
        X = 255
    }



    public class DepthMarketData
    {
        public DMarketDataType type;

        //交易日期
        public String tradingDay;

        ////结算组代码
        //public String settlementGroupID;

        ////结算编号
        //public Int32 settlementID;

        /// <summary>
        /// 市场ID
        /// </summary>
        private Char exchID;
        public Char ExchID { set { exchID = value; } get { return exchID; } }

        /// <summary>
        /// 产品ID
        /// </summary>
        private String productID;
        public String ProductID { set { productID = value.Trim(new char[] { '\0' }).Trim(); } get { return productID; } }

        //最新价
        public Double lastPrice;

        //昨结算
        public Double preSettlementPrice;

        //昨收盘
        public Double preClosePrice;

        //昨持仓量
        public Double preOpenInterest;

        //今开盘价
        public Double openPrice;

        //最高价
        public Double highestPrice;

        //最低价
        public Double lowestPrice;

        //数量
        public Int64 volume;

        //成交金额
        public Double turnover;

        //持仓量
        public Int64 openInterest;

        //今收盘
        public Double closePrice;

        //今结算
        public Double settlementPrice;

        //涨停板价
        public Double upperLimitPrice;

        //跌停板价
        public Double lowerLimitPrice;

        //昨虚实度
        public Double preDelta;

        //今虚实度
        public Double currDelta;

        //最后修改时间
        public String updateTime;

        //最后修改毫秒
        public Int32 updateMillisec;

        //合约代码
        private String instrumentID;

        public String Stkid { set { instrumentID = value.Trim(new char[] { '\0' }).Trim(); } get { return instrumentID; } }

        //申买价一
        public Double bidPrice1;

        //申买量一
        public Int32 bidVolume1;

        //申卖价一
        public Double askPrice1;

        //申卖量一
        public Int32 askVolume1;

        //申买价二
        public Double bidPrice2;

        //申买量二
        public Int32 bidVolume2;

        //申卖价二
        public Double askPrice2;

        //申卖量二
        public Int32 askVolume2;

        //申买价三
        public Double bidPrice3;

        //申买量三
        public Int32 bidVolume3;

        //申卖价三
        public Double askPrice3;

        //申卖量三
        public Int32 askVolume3;

        //申买价四
        public Double bidPrice4;

        //申买量四
        public Int32 bidVolume4;

        //申卖价四
        public Double askPrice4;

        //申卖量四
        public Int32 askVolume4;

        //申买价五
        public Double bidPrice5;

        //申买量五
        public Int32 bidVolume5;

        //申卖价五
        public Double askPrice5;

        //申卖量五
        public Int32 askVolume5;

        public DepthMarketData()
        { }

        public override String ToString()
        {
            return "UpdateTime:" + updateTime.Replace(" ", "") +
                   ",StkID:" + ExchID + "" + Stkid +
                   ",Open:" + openPrice +
                   ",Last:" + lastPrice +
                   ",Volume:" + volume +
                   ",Amount:" + turnover;
        }
    }

}
